package Demo.demo18;

public class Monster {
    String name;
    int hp;
    int attack;
    int defence;
    String weapon;


    public void responses(Hero h) {
        System.out.println(this.name + "甩动着"+weapon+"冲向了"+h.name);
        h.injured(this);
    }


    public void injured(Hero h){
        int lostLife = h.attack - this.defence;
        if(lostLife <= 1){
            lostLife = 1;
        }
        this.hp -= lostLife;
        System.out.println(this.name + "受到"+lostLife+"点伤害~~,剩余血量:" + this.hp);
    }
}
